package org.example.myleet.p806;

public class Solution {
    public int[] numberOfLines(int[] widths, String s) {
        int lineCount = 1, width = 0;
        char[] sArr = s.toCharArray();
        for (char c : sArr) {
            int charWidth = widths[c - 'a'];
            width += charWidth;
            if (width > 100) {
                width = charWidth;
                ++lineCount;
            }
        }
        return new int[]{lineCount, width};
    }
}
